package com.tedu.oop.day3;
/* 继承 extends

 */
public class Test2_Extends {
    public static void main(String[] args) {


    }

}
class Student{

    private int age;
    private int num;
    private String name;
    public int grade;

    public Student() {
        System.out.println("无参构造方法");
    }

    public Student(int age, int num, String name) {
        System.out.println("全参构造方法");
        this.age = age;
        this.num = num;
        this.name = name;
    }

    public int getAge(){
        return age;
    }
    public void setAge(int age){
        this.age=age;
    }
    public int getNum() {
        return num;
    }
    public void setNum(int num) {
        this.num = num;
    }
    public String getName(){
        return name;
    }
    public void setName(String name){
        this.name=name;
    }

    private void study(){
        System.out.println("学生好好学习！");
    }

    private void eat(){
        System.out.println("学生吃饭！");
    }

    public void life(){//私有方法通过公共方法调用
        study();
        eat();
    }

}

class Teacher{
    private int num;
    private String name;

    public String subject;

    public  Teacher(){
        System.out.println("我是一个无参构造方法");
    }

    public Teacher(int a,String b,String c){
        System.out.println("我是一个全参构造方法");

        System.out.println(a+b+c);
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    private void teach(){
        System.out.println("老师上课教书");
    }
    private void eat(){
        System.out.println("老师吃饭");
    }

    public void work(){
        System.out.println("老师吃饭");
        teach();
        eat();
    }
}

class Girl extends Student{


}
class Boy extends Student{

}

class Men extends Teacher{

}

class Women extends Teacher{

}
